package yf.mall.dao;

import com.yf.dao.BaseDao;
import yf.mall.entity.AccountEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 账户Dao
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Mon Aug 26 16:58:11 CST 2019
 */
@Mapper
public interface AccountDao extends BaseDao<AccountEntity> {
    //找到用户的某个账户
    AccountEntity findByUserIdAndType(@Param("userId") Long userId, @Param("type") int type);

    void increase(@Param("userId") Long userId, @Param("type") int type, @Param("amount") BigDecimal amount);

    void decrease(@Param("userId") Long userId, @Param("type") int type, @Param("amount") BigDecimal amount);

    List<AccountEntity> findByUserId(Long userId);

}
